Jmeno PC dle IP
Otázka od: Dalibor
23. 7. 2004 8:01
Ahoj, mam funkci na zjistovani jmena PC dle IP adresy.
V me siti mi vraci u kazde IP adresy jmeno "privat"
Da se s tim neco delat?
Vypis funkce
function HostByIP(IP:PChar):string;
var
wVersionRequested : WORD;
wsaData : TWSAData;
Addr:LongWord;
p : PHostEnt;
begin
Result:='Can''t reslove host';
p:=nil;
{Start up WinSock}
wVersionRequested := MAKEWORD(1, 1);
WSAStartup(wVersionRequested, wsaData);
{Get the Host Name by address}
Addr:=inet_addr(IP);
p := GetHostByAddr(@Addr,128,AF_INET);
{Shut down WinSock}
WSACleanup;
if p<>nil then Result:=p^.h_Name;
end;
Odpovedá: Matejcek Petr
26. 7. 2004 20:00
jake pro to pouzivate knihovny ?? me ta Vase funkce nefunguje vubec (
identifikace promennych )
P.M.
Dalibor napsal(a):
>Ahoj, mam funkci na zjistovani jmena PC dle IP adresy.
>V me siti mi vraci u kazde IP adresy jmeno "privat"
>Da se s tim neco delat?
>
>Vypis funkce
>
>function HostByIP(IP:PChar):string;
>var
> wVersionRequested : WORD;
> wsaData : TWSAData;
> Addr:LongWord;
> p : PHostEnt;
>begin
> Result:='Can''t reslove host';
> p:=nil;
>
> {Start up WinSock}
> wVersionRequested := MAKEWORD(1, 1);
> WSAStartup(wVersionRequested, wsaData);
>
> {Get the Host Name by address}
> Addr:=inet_addr(IP);
> p := GetHostByAddr(@Addr,128,AF_INET);
>
> {Shut down WinSock}
> WSACleanup;
> if p<>nil then Result:=p^.h_Name;
>end;
>
>
>
>
>
>
Odpovedá: Dalibor
27. 7. 2004 6:09
Ahoj, musis dat do USES jeste WinSock, potom by to to melo fungovat
----- Original Message -----
From: "Matejcek Petr" <konference@crhov.komfi.cz>
To: <delphi-l@clexpert.cz>
Sent: Monday, July 26, 2004 9:00 PM
Subject: Re: Jmeno PC dle IP
> jake pro to pouzivate knihovny ?? me ta Vase funkce nefunguje vubec (
> identifikace promennych )
>
>
> P.M.
>
> Dalibor napsal(a):
>
> >Ahoj, mam funkci na zjistovani jmena PC dle IP adresy.
> >V me siti mi vraci u kazde IP adresy jmeno "privat"
> >Da se s tim neco delat?
> >
> >Vypis funkce
> >
> >function HostByIP(IP:PChar):string;
> >var
> > wVersionRequested : WORD;
> > wsaData : TWSAData;
> > Addr:LongWord;
> > p : PHostEnt;
> >begin
> > Result:='Can''t reslove host';
> > p:=nil;
> >
> > {Start up WinSock}
> > wVersionRequested := MAKEWORD(1, 1);
> > WSAStartup(wVersionRequested, wsaData);
> >
> > {Get the Host Name by address}
> > Addr:=inet_addr(IP);
> > p := GetHostByAddr(@Addr,128,AF_INET);
> >
> > {Shut down WinSock}
> > WSACleanup;
> > if p<>nil then Result:=p^.h_Name;
> >end;
> >
> >
> >
> >
> >
> >
>
>